#ifndef _HISTORY_H_
#define _HISTORY_H_

#include <stack>
#include "CreateCommand.h"
#include "DeleteCommand.h"
#include "UpdateCommand.h"

/*
* Class name: History
*
* This Class records the sequences of undoable/redoable commands executed without touching on the storage.
* 
* Whenever an undoable/redoable command (create, delete, update) is executed, a pointer to that command will 
* be pushed into undo stack. When undo/redo command is called, History will return a pointer to that command to
* the logic to call the unexecute/execute method. Thus, History only interacts with logic, which reduces coupling.
*
* UpdateCommand only has three APIs:
* InsertUndoRedo(ICommand*) for recording the execution of any undoable/redoable commands.
* getRedo() for returning a pointer to the latest redoable command.
* getUndo() for returning a pointer to the latest undoable command.
* 
* @author A0105475H
*/
//@author A0105475H

using namespace std;

class History
{
public:
	History(void);
	~History(void);

	ICommand* getRedo();
	ICommand* getUndo();

	void InsertUndoRedo(ICommand*);

private:
	stack<ICommand*> undo;
	stack<ICommand*> redo;

	bool isUndoEmpty();
	bool isRedoEmpty();
};

#endif

